package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.query.NewsQueryObject;
import cn.wolfcode.trip.base.service.INewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("newsRelease")
public class NewsReleaseController {
    @Autowired
    private INewsService newsService;

    /**
     * 已发布日报页面
     *
     * @param model
     * @param qo
     * @return
     */
    @RequestMapping("list")
    public String list(Model model, @ModelAttribute("qo") NewsQueryObject qo) {
        qo.setState(1);
        qo.setOrderBy("n.releasetime desc");
        model.addAttribute("result", newsService.queryForList(qo));
        return "news/release";
    }
}
